<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>卡券管理</title>
    <link href="{:C('WEB_URL')}Public/admin/style/base.css" rel="stylesheet" type="text/css" />
    <link href="{:C('WEB_URL')}Public/admin/style/master.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="{:C('WEB_URL')}Public/admin/js/jquery1.9.1.js"></script>
    <script type="text/javascript" src="{:C('WEB_URL')}Public/admin/js/base.js"></script>
    <script>
        function del(id){
            if(confirm('确定要删除记录吗?')){
                var url="__URL__/del/c_id/"+id;
               // alert(url);
				$.getJSON(url,function(data){
                    if(data['status']==1){
                        $(".list > tbody").children("#J_list"+data['data']).remove();
                    }else{
                        alert(data['info']);
                    }
                })
            }
        }
        
        function used(id){
            if(confirm('确定要启用记录吗?')){
                var url="__URL__/used/c_id/"+id;
               // alert(url);
				$.getJSON(url,function(data){
                    if(data['status']==1){
                    	alert(data['info']);
                    	
                    }else{
                        alert(data['info']);
                    }
                    
                    location.reload() ;
                })
            }
        }
        
        function unused(id){
            if(confirm('确定要禁用记录吗?')){
                var url="__URL__/unused/c_id/"+id;
               // alert(url);
				$.getJSON(url,function(data){
                    if(data['status']==1){
                       // $(".list > tbody").children("#J_list"+data['data']).remove();
                        alert(data['info']);
                    }else{
                        alert(data['info']);
                    }
                    location.reload() ;
                })
            }
        }
        
    </script>
	<style type="text/css">
	.box-info{position:absolute;top:0px;bottom:0;right:0px;left:0px;border:1px solid red;background-color:rgba(144,144,145,0.5);display:none}
	.UE img{height:30px;};
	</style>
</head>
<body>
<body>
    <div id="wrapper">
        <h2>卡券类型<a href="{:U('edit')}" class="but_add">添加</a></h2>
        <table class="list">
            <thead>
			<!--筛选-->
		<form action="{:U('index')}" method="post" enctype="multipart/form-data">
        
		类型名称:<input type='text' class='inputText' name='mark' value="{$_REQUEST['mark']}"/>
			
			<input type='submit' value='搜索' class='btnOrange'>
		</form>
                <tr>
					<th>卡券ID</th>
					
					<th>状态</th>
					<th>类型名称</th>
					
					<th>每日消费次数</th>
					<th>每日起始时间段</th>
					
					<th>每日终止时间段</th>
					<th>操作</th>
                </tr>
            </thead>
            <tbody>
            <volist name='list' id='vo'>
                <tr align="center" id="J_list{$vo['c_id']}">
                    <td>{$vo['c_id']}</td>
                    <!--  所属类型  1.商家  2.活动
                    
                    <td>{$vo['coupon_type']}
                    
                     <?php 
                     
                     if($vo['coupon_type']==1){echo "商家";}
                     
                     else if($vo['coupon_type']==2){echo "活动";}
       
                     else if($vo['coupon_type']==1){echo "其他";}

                     ?>
                    
                    </td>
                    -->
                    <td>
                         <!--  卡券类型  1.普通卡券 2.次数限制的消费卡券 3周一至周五的 4周六至周日的 5.特殊时间段的 
                    
                    -->
                    
                     <?php if($vo['c_type']==1){echo "普通卡券";}
                     
                     else if($vo['c_type']==2){echo "每日次数限制型";}
                     
                     else if($vo['c_type']==3){echo "周一~周五";}

                     else if($vo['c_type']==4){echo "周六~周日";}

                     else if($vo['c_type']==5){echo "特殊时间段";}

                     else {echo "其他";}


                     ?>
                     </td>
                     
                    <td>{$vo['mark']}</td>
                    
                    <td>{$vo['c_count']}</td>
                    <td>
                    <?php 
						echo date('H:i:s', $vo['start_time']); 
                    ?>
                    </td>
                    
                    <td>
                    
                     <?php 
						echo date('H:i:s', $vo['end_time']); 
                    ?>
                    
                    </td>
                    
                    <td>
                         <!--<?php if($vo['status']==2){ ?>

                                  <a href="{:U('edit',array('c_id'=>$vo['c_id'] , 'nowPage'  =>$nowPage  ))}" class="edit" >查看详情</a>
                                 
                           <?php   }?>
                           
                        -->
                     
                           
                     
                           <?php if($vo['status']==1){ ?>

         							<span class="del" onClick="unused({$vo['c_id']})">禁用</span>                                 
                           <?php   }?>
                           
                             <?php if($vo['status']==0){ ?>

         							<span class="del" onClick="used({$vo['c_id']})">启用</span>                                 
                             <?php   }?>
                           
                           <a href="{:U('edit',array('c_id'=>$vo['c_id'] , 'nowPage'  =>$nowPage  ))}" class="edit" >查看详情</a>
                     
                     
                               <!--   <span class="del" onClick="del({$vo['c_id']})">删除</span> -->
                                 

                    </td > 	
                    
                   
                           
                        
                    </td>
                </tr>
            </volist>
            </tbody>
        </table>
        <p class="hr_10"></p>
        <div class="pages">{$page} </div>
    </div>
	
	<div class='box-info'>
	</div>
<script type="text/javascript">
	  $(document).on("click","a.J_itemDel",function(){
                $(this).parent("li").remove();
            })
</script>
</body>
</html>